//
//  ZYCTeachLearningPaperModel.m
//  ZDSC
//
//  Created by ZDTX on 2021/9/2.
//

#import "ZYCTeachLearningPaperModel.h"

@implementation ZYCAnswerModel



@end

@implementation ZYCSubjectModel


//- (BOOL)isPaper{
//    if ([self.subjectType integerValue] == 3) {
//        if (self.answerContent.length == 0) {
//            return NO;
//        }else{
//            return YES;
//        }
//    }else {
//        NSArray *checkFlagArr = [self.subjectItemVoList valueForKeyPath:@"checkFlag"];
//        if ([checkFlagArr containsObject:@1]) {
//            return YES;
//        }else{
//            return NO;
//        }
//    }
//    
//}


//subjectType 题目类型（1：单选题；2：多选题；3：简答题）
-(NSArray *)selectAnswer{
    if ([self.subjectType integerValue] == 1) {
        for (ZYCAnswerModel *answer in self.subjectItemVoList) {
            if (answer.checkFlag) {
                return [NSArray arrayWithObject:answer.subjectItemId];
                break;
            }
        }

    }else if([self.subjectType integerValue] == 2){// 多选
        NSMutableArray *temp = [NSMutableArray array];
        for (ZYCAnswerModel *answer in self.subjectItemVoList) {
            if (answer.checkFlag) {
                [temp addObject:answer.subjectItemId];
            }
        }
        return temp.copy;
    }else if ([self.subjectType integerValue] == 3){
        return [NSArray arrayWithObject:self.answerContent];
    }
    return nil;
}


//subjectType 题目类型（1：单选题；2：多选题；3：简答题）
- (NSString *)subjectTypeStr{
    if ([self.subjectType integerValue] == 1) {
        return @"(单选题)";
    }else if([self.subjectType integerValue] == 2){
        return @"(多选题)";
    }else if([self.subjectType integerValue] == 3){
        return @"(简答题)";
    }else{
        return nil;
    }
}
+ (nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass{
    
    return @{@"subjectItemVoList":[ZYCAnswerModel class]};
}

@end

@implementation ZYCTeachLearningPaperModel


+ (nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass{
    
    return @{@"subjectVoList":[ZYCSubjectModel class]};
}

//
//- (BOOL)isDone{
//    for (ZYCSubjectModel *subject in self.subjectVoList) {
//        //subjectType 题目类型（1：单选题；2：多选题；3：简答题）
//        if ([subject.subjectType integerValue] == 3) {
//            if (!subject.isPaper) {
//                return NO;
//            }
//        }else{
//            if (!subject.isSelect) {
//                return NO;
//            }
//        }
//        
//
//    }
//    return YES;
//}


@end
